Big refactoring update.
Added the client and server distinction, refactored server to be a tad more modular ( hello OOP ;) ).