added some additional handling in controller