updated stored procedure