Updated code

the whole thing