Cleanup.

Type parameters added; Unnecessary variable and branches removed;
Used Interface instead of class