brought back the weak entity pointer, which also caused some refactoring