moved over source files
working version. about to cleanup
explanation
further code duplication reduced. Finally a version without "no" code duplication. and clearly mentioned comments for how to modify
Finalized for easy reuse / modification by others.