move toString method, add javadoc