Moved some logic to hook controller