Updated version, with dictionary support