Added check for cli arguments; renamed some variables for clarity