stored procedure almost working...