Small improvements + exemple of use in main.cpp

I made some changes to the code and added a main.cpp to show the use of
classes