code clean up

Some code clean up with if else's.