Started porting conditions code