fixed and optimizezd decoration making algorithm