added pointer based function