fix percent calculation & rewrites