cleaned up code
fixed merge conflicts