first push at solution -- looks about right