added cache func (in progress)