Bug and performance fixes

Added setting to only persist 5 items