error handling & cleanup & rename