encodes data and stuff