Need to get test cases added around all this logic.