Change to a type class based structure for abstraction