updated ecstasy_function.R