Move create unit code & cleanup