Adding tests and some logging