changed coding pattern to prototype