moved math functions to math util class
cleanup mainwindow