Logging implemented - still needs more work