Simplified and updates

Simplified and updates and bug fixes.