Updated code to work for a basic example