code refactoring, minor bugs fixes

- clearing the divs before appending new info