Merged my autoconf with Brian's improvements