Improved type checking and error handling
Use new constructor syntax