Removed more obsolete code
Added a global result counter