Refactor to use type-mapping instead of if/else cascade