code and figures