code: https://gist.github.com/bhoung/769ea023915bc7f6802f667249b54508

drawing