To fix minor bugs, added more inline documentation and a documentation file