added documentation and comments and shit