refactor data controller