Fine tuning and adding some code