Splitted the main code into modules