added avoidance for collecting resources (does not compile yet)