Explicit resource directory logic

There were some problems due to init() order and what not. This patch
makes the whole thing more straightforward to follow.
!$ and !!