Renamed constants and tidied up.