Rewrite in C-style