add ratio parameter
add gate (and a few other things that weren't added)