Refactoring

function via prototypes