Refactor and make variables configurable