Solved P2

Could be cleaner?