changed helper func signature, removed dead code