cleaned up code layout