split layouting code off from  compileBF