added resolve theirs option and cleaned up