added code for distribution