My solution, I'm not proud of it...