part of light-building macros extracted into functions
cube building function extended to work iteratively