Fixed controller code