Fixed a few bugs in the code (tid = 0, stopp alle inne i løkke)