updated for #4 solution