Added next and previous buttons to overlay and fixed redundancies in script.js