Implementing the pan tool