Updated code so that it works in a basic way