Added pks.templates class and event triggers