added comments to functions
added saving cache to the hard disk