+/- modified doAppend to avoid NPE
+/- reformat class to comply to coding rules