Refactored Existing Code

Removed unneeded declarations. Removed unneeded imports. Used better encapsulation.