Create full table in function not just parts of it