Refining code - half done