little fixes: 1) I did forget to put "this" in some function calls, 2) I used Math.round instead of Math.floor in one function