Refactored and added demo.