General formating and code cleanup