Added more support code for custom types