Adding type hints for performance and to silence warnings