Refactored a bit more, the numerous calls to determine UA parts in each function have been replaced by a global