refactored connect states and tasks
added caret position retrieval
renamed a few classes and made Peer serializable