core: Clean and improve