modified asd file so everything compiles at first attempt
tidied up the code