set speed correctly to integer
Calculate if we should use horizontal or vertical implementation
removed trailing whitespace