Improved code for creating new instances

Signed-off-by: Phil Mander <philip.mander@gmail.com>