Refactor design and secure task managers