quick and dirty refactor