Code cleanup and style update