added first edit / add contract logic