Updated Stored Procedure