refactored background drawing