Updated for unit testing, WIP for integration tests