FIX: code from tutorial meg-rs