updated/fixed the return conditions