Ex 140 Edited (Added a helper function)