minor optimisations and cleanup
Merge branch 'master' into Corner8

Conflicts:
	main.cpp
wrong index