refactored the getNewXSpeed method