Implement solution 1. Nice, but has some bugs
Implement solution 2. Not as nice, but works as original