Fixed code with Times API changes. Other optimizations