manually merging tump code from josh