Factor shared functions into separate source files.
oops
Add build targets.
Merge pull request #152 from shans/factorOutShared

Factor out shared functions into separate source files.