refactor code left undone