Major overhaul. Moved to autotools.