almost final changes made to controller