cleaned up main code
cleaned up main code 2