Modernized the code

Made the implementation easier