Shortened the code and fixed a bug (wrong "self" reference in Print.java)