refactored after #50