moved to a void function