Code reformatting and attempting to create a main controller