refactored code, adapted to qt5, modified layouts