inital version
initial version
tidied up