Introduced real I/O and main method

First version, ready for use