easy, not very elegant code, still good