Code and style corrections