Fixed final function

Fixed even/odd function