add unicorn template and code refactor