Added documentation to functions. Not finished yet.