Refactor presence tests