What was wrong with this code?