Some code clean up here and there