update type hint, plus some coding style updates