Added comments and fixed code standard