separated standalone and R versions