Finalized code after Week 4: Solved problem regarding the unexpected sliding when entering math insets