passes out of boundaries test
refactored move method