Refactoring of the main function + added support for sending data without send/open