Added & tested generic print function