edit function half way working