refactoring, fixed bug #1 (see trello)