Moved functions to separate module.