more error handling, writing logs where needed