Using SetEx, and better error handling