drop useless parameter
add logging
refactor active_profile calculation