removed inefficient code from data controller