added templated solvers, refactoring