refactor according to comment #76