moved some logic to controller