big commit...lots of debugging to be done...