followed scala tutorial