some performance improvements. note to myself: reflection is slow!