code clean-up to ensure reference exist and code is closer to PEP-8