fix drag behaviour and add key codes