re factored some more