Fix variable mistakes & allow configuration to be passed