first commit, solved with inefficient method