Split common functionality into multiple files.
Merge pull request #17 from fwalch/split-common

Split common functionality into multiple files.