Working on functions a bit

Types not 100% but mostly done with basic functions.