Template fixes, minor changes on functionality