refactored prototype assignment into a function