Fixed xor encryption and reworked connection