Cleaned Code for various files

Rearranged the code to make it look neater.