added option to pass prototype