modifications for edit mode ( is working now )