fix code and add controller