Initial refactor complete, code cleaned up a little more