Added new function files and fixed things