added option to switch between detecting alu head and solid end