finalized and optimized ;)