Re-factored and changed design