Cleanup & Error handling improvment