multiple changes: cleaning code, adding new function, improving demo