finishing the demo
refactor some more