Implement control socket

closes #3