code copied from calude – rest of code