a big refactor and design change