added if...else statements for special circumstances