updated some logic in controllers