generate cleaner code with empty blocks removed