update move method to fix bug and clean code