Refactor HOF method transformation and improve documentation