It may be worthwhile to combine this with the function above.