attempt to simplify code