added more code and figures