Refactored some local vars