Changes to make the base code more generic.