Some nice changes in structure to be more flexibel but reducing code