Code cleanup & reformat