add type and logic in scala