[IMPROVED] Error Handling, logging