refactor data types into classes