cleaned up error handling; trimmed defaults