Added exception handling and result sets.