adding print function; fine tuning still required