Massive change

Studied Baavgai's stuff from DreamInCode