Switched to using hastables for simpler code