approved by mats and fixed unnecesarry if-statement