Various code clean-up