Fixed merge conflicts and a few bugs that may or may not have been caused by it