added working controller code