#19: Refactor js code for THM (mainly comments)
#25: changed timing of speed increment for THM