Uses a visitor function to iterate over configurations

Reduces code duplication by using a visitor function.
Also renamed the functions for aesthetics, but that's just me :)