wrote my solution, works as planned