correcting types, improving documentation