simplify logic (needs test)