Change defaultContext to include head and scripts. Change logic role to use group expressions