changes for use with optical endstops