More code added, probably ready for testing, still needs port numbers