Merged our changes and fixed some bugs