Adding tests and testability changes