Further clean up of defunct functions. Splitting up functions between different files