Merge pull request #22 from mk270/mild-refactor

Ongoing gradual refactor / code cleanup / modularisation
Add dependency
factor branches together
use platform-independent filename handler