starting to add logging and exceptions