no global variables and better settings handling