more flexibility and fixes