Fixed possible, though unlikely, cause of levels file being deleted.
Also a bit of formatting and cleanup.