lap:partially refactored