Simplifies code using functions