further modified the move functions. still needs testing