Added code

In the process of splitting up the code.