updated distribution code after #3