bug fix - forgot type declarations
organization, added function prototypes, capitalized functions... Made slight changes to rotate 180