work in progress to fix the bug2989
made some changes so that the navigation history can function corect
some changes into the removeFile method
some redundancy changes made here