using record instead of hash-map