just little fixes, code is a mess, but in my defence, I wrote it a million years ago