rewrote code - implemented class & objects