Refactored the code dealing with responsiveness.