major refact ongoing