2 functions added to simplify code