Main class with nio code