Style fixes and other modifications

Style fixes and other modifications
Fix parameter checks, other style fixes.