Updates to testing and refactor of code.