code clenup & fixes