furthered rafactored code based on pylint analysis