Refactor, bug fix, and outside TAL functionality