Optimized server a bit.
Wrote some interfaces.