Some attempts at optimization