Improving ricardo's code