Refactored to make some methods private