minor optimizations
added docs