working version - spottily