Updated documentation. Simplified function