implement the endstop functionality
fix end stop directions