Initial port from javert and rewrite