Test and code clean-up