kinda done, but should maybe use hashtable instead