made class self contained
finished refactoring