improve performance.

todo : namespace, wrapper class, factory functions.