added some code to controllers