style fixes, separate functions