A few more prettifications and fixes after testing; moved all checks into functions+$tasks.