Added boilerplate, some refactor.