Organized and removed unnecessary code