Revision 2

Re-wrote entire code because the original code got deleted