added more code for distribution