another try to simplify code