tweaked some internals for performance