Cleanup and Complete

A little cleanup and uploaded the functions php file.