updated the code for unit activation and unit edit