Refactoring from Twirl with docs and tests update