Added some function definitions

Added some function definitions. Still needs some functions defined and alternative solutions using guards and pattern matching