added sprinting and cleaned up the code