Spinlock cleaned
Added calculation of median (1 doens't work yet)