Updated scala class code