condensed and simplified code