refactroing the whole repository