Fix some (memory) bugs, and some warnings
move from float to 32bit integer calculation (to get a modulo for free).
UI improvements and tweaks.