A few things are still broken and it can use some refactoring, but its kinda close