refactor: major refactor and removing deprecated code