Implemented functions, and fixed things.