Refactor getting the first element from the config
Refactor the parsing of lots of sections
Fix a lot of potential null pointer issues