all this could be made with a class on mainWrapper