refactored a couple of vars