waiting bug fix

I have fixed a data waiting bug. I fixed it by moving makeTableHTML
function inside trainingcollector function and adding append function
inside makeTableHTML, instead of calling append outside.
Function dataToArray has been renamed to trainingCollector because of
name nonsense after changes.