All functions working, some feature system stuff

Still needs proper input checking and error handling and all that good,
ugly stuff.