Added caching of recently viewed elements + minor improvements