Refactor and cleanup, added examples