Update functions.c

reformatted code for better readability
Merge pull request #24 from capz/patch-14

Update functions.c