Added comments and fixed indentation