Added documentation to lib.rs and database.rs files
Moved code from inside the main function into function calls