Code clean up: Remove unused functions and refactor functions to use
Document. Viva unit tests!!!