Significant clean up of code!!

Revised my boolean function,
cleaned up code and added section for main code
as advised in goto training