Fixes, some rewrite