More Documentation and added a while loop