refactorings as discussed with almoehi