Created some functions for repeated code