bugs fixed, documentation improved