refactored once more