Refactored code, replaced some instance vars with constants