major refactor and new design