Updated documentation and simplified code