fixed doc type hints and minor code cleanup