Fixed whitespaces and simplified code