tidy-up level rendering code