Refcatored code