cleaned up code
cleaned up logic