Scheduling is one of the most successful application areas of constraint programming mainly thanks to special global constraints designed to model resource restrictions. Among these global constraints, edge-finding filtering algorithm for unary resources is one of the most popular techniques. In this paper we propose a new O(n log n) version of the edge-finding algorithm that uses a special data structure called -tree. This data structure is especially designed for "what-if" reasoning about a set of activities so we also propose to use it for handling so called optional activities, i.e. activities which may or may not appear on the resource. In particular, we propose new O(n log n) variants of filtering algorithms which are able to handle optional activities: overload checking, detectable precedences and not-first/not-last.