Sam's changes rebased