still refactoring from test page into kernel