Refactor and add method for easy endpoint init.
Global refactoring, improve configuration.