Cleanup, move resolve_path_with_dots to cs_globals
minor refactor
Template tests