Added toDictionary helper func