this code also has provision for memory alignement