code clean up and package level encapsulation