I did this in netbeans, hope it doesn't break something.

Put out the 'structure' to use in the server class and a few functions in other classes.
Please let me know what you think of this.