Fixing code for first working version