Reworked for new data structure, bugs present