Added perception count realtime graph and refactoring