fixed more issues with initial test
Fixed testing setup to avoid duplication. Fixed error codes on exceptions.