modifying paint method of boxes (to increase performance during execution)