Added enums for errors and types
Added anonymous function calls