Work on refactor and code clean up