Dematerialize

PR for #37

Someone might want to help me with proper unit tests :)