More error handling and fine grained exceptions