Should compile and work fine now, might still have bugs