added termination conditions
added references