moved debug functions into library
added initialization routine to calculate the number of steps from one
end to the other
fixed set speed in initialization