added maxSize and maxTime functionality