restricted access and some refactoring