Added code refactoring and some tests. Added some changes in the classes
logic and fix class names.