Added type definitions to functions