Changed to use the looping sequenceWhile