Removed useless variables and moved necessary variables inside the class