Reverted several cnahges to fit with the original version.