edited to actually work