code now works