Better working code