Added log function with count system. Fixing #3