Refactor edit page