Tests' code clean-up.
Added: missing dependency checks in template module.
Removed: pointless conditions in template module.
Added tests for template module.