Rewrite without sonata

Do not merge.