my solution to learnyounode challenge