Number of links shown adjust based on screen space

The code is quite messy and needs to be cleaned up however
Bug fix for when a range error can occur on small screens