Refactored WCFR code - used variables declaration moved to being of functions body