refactor to fit existing structures