Some optimizations and better error handling