Removed unneeded code, simplified to putting comparison on return