- restructure the code a bit

- get rid of HAVE_* flags
