simplify architecture, cleanup code