added source code and figures