Replaced some size calculations with macros