Added cap and cleaned up