add gm
update index
refactor attachments
refactor pages api
remove check for varchar type
refactor dao