key bindings stuff and sp function