attempts at optimization