Moving functionality from global functions to methods