Attempting to reduce the amount of duplicated code