Code clean-up and updates