Added error logging

Added error logging to track and squash issues #2 and #3