Changed rectangle to pole, made variables private, added some functions and added appropriate comments in the code.