Updated codebase for pandas 0.14 as old version's count() was very slow. Added some logging