Updated select procedure.