Split shape creation into separate function