Improved general code