Misc codes (all in java)