Adding finalversion of the program (everything working well)