refactoring
added some documentation