Implemented some error-handling
Implemented basic logging