general refactor and first got at wbesockets
version for review