Attempt at making sane main function