small code improvement and style fixes