Did minor changes to improve code style & encapsulation