Dan commit

reorganised code
fixed graph gui