add minimize version of the code