thesis search - code cleanup, pull JS out into separate file