Fixing some code standards and improving code