Code reorg, category headers

CODE SHOULD BE IDENTICAL
Just moved order of functions around.