fwcsa implement of scala