Refactoring edit item, adding sorting