added removeStaleEntries() and removed some static analysis violations