Did some refactor and added some testing on uncovered code.
Merge pull request #244 from lyncodev/refactor

Removed deprecated API