caching added and multiple minor changes