Internal refactoring to full strong typing