finished the spike. works for basic usage
refactored into a real PS module