Refactor data mangement