Add type hints and rename function