cleanups, add x element processing and config parser