Code cleanup and code standard fixes