changed ugly hashmap to table