http://www.pythonchallenge.com/ reworked