better error handling, use index or user defined default