implements % function