started refactor to best pratices