added comments and start with documentating all functions