major update, reformat files & fix bugs