final code
merge solution