Added caching to improve performance of certain methods.