update functional solution slightly