Add examples and refactor