add conditions and documentation