Added whilst and doWhilst functions.