Added Pythagoras and a bit of cleanup