Refractoring code , changing class name and declaring variables outside the class