moved try statement, and eleminated some extra code