cleaned up code (a bit) and made sloth better