restructure and recompile code