Firebug warnings fixed, removed duplicate code and changed unstable test.