tuning up the code