Little tidy up and added checks for redefinitions.