factor branches together
use platform-independent filename handler
use iterator
use oursql