Refactor jQuery chaining for initial templates