Functions additions, more splitting and organizing

I'll probably revert some of this or whatever. I can never make up my
mind.