sample written in scala