Refactored some code. Got ride of extra variables.