edited for addition of the floating mode.