Refactor/snippet feature

Refactor the snippet feature and add first unit and integration tests