Exception handling and errors flashing added