Improving answer code