First functional version of the refactory