Added readInt and writeInt functions