separated out the functionality... its quite broken, but its a start
ok