method name updated from getBytes to getByteCount
removed forIn function