migrated scala example to new strcture