Updated code

Functionality completed