Restructure device angular code.