replaced all the size calculations with a single reference