some refactoring / missing phpDocs added