Additional unit testing and bug fixes

Did some integration testing locally to make sure things work