edited to add more code