added when statements