changed size parameter to generic