fixed NONE type error and added multiple parent possibility as well as new
decision mechanism for parent selection