Changed classes to template classes
Fixed merge conflicts