Added documentation ; extended functions.