Improved documentation + some revised code