Rewrites str2int function. Added few conditions. But it still needs to be add more conditions