Shortened code using helper functions