updated to include dist argument