removed private method, refactored code