Fixed issue #4 by splitting function.php, should make it easier to add new features in the future