Updated code to latest version