added headless mode