Code optimization and style change