code clean-up and adding imports