Rewrite (nu zonder bugs)