Moved parameter reading to separate function