change size function to N variable