Fix bugs and refactor
Link to demo