Changes from Mike Line's 0.5 version