added first move function, fixed js bug