Added overlay() and helper function calculate_color()