addded setting class and improved main.cpp