major refactor (cont.)