Implemented cache support, and other improvements.