removing some redundancies, clearing up names, refactoring socket