added pythagoras function
fixed Daniel's bug