Upgraded Version and Updated Error Handling