Refactoring several classes according to issue #25