Trying to debug the penudlum losing energy