added generic support, spring DI, refactoring