refactored psmc