Added protocol package + refactoring.