Splitted up the code to separate files