now encoder attachment can be detected, switched index in login to mode to choose online or offline, added code to gracefully exit program (close all sockets...etc)