Refactor for better snippet support, add snippets