First refactor and fix/removal of some of the TODO comments