Added comments and renamed for clarity