Cleanup.

Type parameters added; Unnecessary variable and branches removed;
Used Interface instead of class
Merge pull request #21 from PetrGlad/cleanups

Cleanup.