refactering lego blocks