working code before deleting extras and testing