Contine refactor...this is a mess atm..