simplify code a bit