Added a print method.

Added a print method and a main method for testing.