Slight refactoring; added public api methods