Refactored more code and started tests. Will add more in the morning before meeting
mergin