Used template inheritance. Reorganized stuff.