big refactor to adopt implementation pattern