Adding modularity

putting functions in different places