minor improvements and new nonlinearity test