Cleaned up structure

working on separating functions into different files