Adding thread management to controller