Seems like it's almost done, just small bugs due to incorrect indexing. Shouldn't be too hard to fix