Better design and changed few bits of code