Tidy & simplify code