Optimise code and better doccd

Optmised code by using a var to store the Avatar and Online Status
instead of scanning the whole page 3 times (each) to find, add and
remove classes