Several refactoring and added documentation for day 2