Revision 3

Reworked code to match project requirements