Refactor to demo library style.