refactor some of the current implementation