added support for tristate behaviour