Controls if program is over + bugfixes