cleaned up code, and fixed conflict