Added options for custom types.
Imprived counter handling.