refactor edit links
refactor pages model and controller