Updated unit tests and minor cleanup