fixes, cleaning, expansion template