some cleanup & rewrite records-iterator