replaced if - statement with single line