rearranged some definitions, fixed config issues