Added some code organization and corrected blatant errors