Add Encapsulation and extract to source files