Improved configure script