added speed control. cleanup & commenting