Performance improvements by caching all reflection, fixes #2 and #3