Fixed variable not being properly set for reg.
Improve logger to split lines too long at clever places to make it look cleaner.