added JavaScript helpers and modified some templates