Added comments, reformatted code.