simplified code by making use of pivot point; added missing 'dispose' call