crude working version