moved [H[J and print message into subroutine