Added support for more conditions