Make function generic
More helpers for sizes
Work in progress