sort out the horrible code indentation mess!