Added feature for being able to pass in dictionary directly instead of a file.