Move data handling to have interface-based API