Code and style cleanup