refactor of the base