Code cleanups
Add some basic logging
Little update to logging and error handling