Made OOP design and divided into smaller methods