performance improvements + javadoc