Getting rid off redundant else statements