Cleanup of set_background

Cleaning up the set_background function