Adding some logging and new tests