fix up some stuff, add type hints