Another stab at the initial implementation for issue #10

This is supposed to resolve issue #10
This supersedes pull request #11

Addressed a few comments from @sumanmukherjee03, rebased on current master