Speed improvements and readability