Merged two functions that did one thing