Function templates and main

Created function templates and added basic stuff to main.