This proc is very messy.