first attempt at solving