Code simplified & wrapped around prototypical function