second solution was better actually