Fix indexing levels
Move search js into seperate file, bug fixes